Fix symlinked .venv interpreter discovery#3509
Conversation
|
Hi @sjh9714! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D106044969. |
Summary
Fixes #3458.
Pyrefly could see
pyvenv.cfgthrough a project-root.venvsymlink, but then used the walk-based interpreter lookup with symlink following disabled. That meant a standard symlinked.venvwas skipped and Pyrefly fell back to the system interpreter.This change checks the standard venv interpreter path directly when
pyvenv.cfgis present, preserving the symlink-prefixed path, and keeps the existing walk-based fallback for nonstandard layouts.Note: I used Codex while preparing this change, and I reviewed the final diff and ran the listed checks locally.
Test Plan
PATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config test_find_detects_symlinked_project_venv(failed before the fix withleft: None)PATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config environment::venv::tests::test_find_detects_symlinked_project_venv -- --exactPATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_config environment::venvPATH="$HOME/.cargo/bin:$PATH" cargo test -p pyrefly_configPATH="$HOME/.cargo/bin:$PATH" python3 test.py --no-test --no-conformance --no-jsonschemagit diff --check